<!DOCTYPE html>
<html>
<head>
    <title>文件上传示例</title>
</head>

<body>
<script src="jquery-1.8.3.js"></script>
<script src="common.js"></script>
<script type="text/javascript">

        function formSubmit() {
            debugger
            var url = "/jan/check_ai";
            var data = $("#data").val();
            $("#out").html("");
            doMyAjax(url,{data:data},"async",function (data) {
                var mess = data;
                if(mess.success==1){
                    var details = new Array();
                    details = mess.detail;
                    for(var i=0;i<details.length;i++){
                        var jsonObj = details[i];
                        for(var key in jsonObj){
                            if((key!="desc")){
                                var html = "<p>提交文本";
                               /* if(key=="sentence"){
                                    html += "<span>" + key + "</span>";
                                }*/
                                html += ": <span>" + jsonObj[key].replace("<begin>","<span style='color: red'>").replace("<end>","\</span>") + "</span></p>";
                                $("#out").append(html)
                            }else{
                                var descs = jsonObj[key];
                                for(var j = 0;j<descs.length;j++){
                                    var desc_obj = descs[j];
                                    for(var k in desc_obj ){
                                        var html = "<p>";
                                        if(k=="error_desc"){
                                            html += "<span>修改描述</span>";
                                        }if(k=="origin"){
                                            html += "<span>原文细节</span>";
                                        }
                                        html += "<span> " + desc_obj[k] + "</span></p>";
                                        $("#out").append(html)
                                    }
                                }
                            }
                        }
                    }

                }
            });
        }

</script>
<style>
    #data{
        width:600px;
        height:200px;
        rows:"6";
        cols:"20";
        background:#ffffff;border-bottom-color:#ff6633;
        color:   #000000;
        FONT-SIZE:   12pt;
        FONT-STYLE:   normal;
        FONT-VARIANT:normal;FONT-WEIGHT:normal;
        vertical-align: top
    }

</style>
<h2>文件上传示例</h2>
<hr/>
<form method="POST" id="myForm" enctype="multipart/form-data" action="/jan/check_ai">
    <p>提交文本：</p>
    <p><textarea id="data" name="data" ></textarea></p>
    <p>
        <input type="button"  value="提交验证" onclick="formSubmit();" />
    </p>
    <div id="out"></div>
</form>
</body>
</html>